﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/TemplateUser.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="AirlineProject.Models"%>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Book2
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<script language="javascript" type="text/javascript">

    $(document).ready(function () {

        $('.keytype').change(function () {

            var type_id = $('.keytype option:selected').val();

            $.ajax({
                type: 'GET',
                url: "http://localhost:2676/Ticket/InfoPrice/" + type_id,
                success: function (data) {

                    $('.price').val(data);

                }
            });

        });

        /*$.ajax({
        type: 'GET',
        url: 'Ticket/SearchPrice/' + type_id,
        success: function (data) {
        alert('aaa');
        $('.price').val(data);
        }
        });


        });*/
    });
</script>
<%
    Flight f = (Flight)ViewData["infoflight"];
    int snum = (Convert.ToInt32(ViewData["kq"]));
    
%>
    <div class="wrapper pad1">
      <article class="col1">
        <div class="box1">
          <h2 class="top">Booking Summary</h2>
          <div class="pad"> 
            <strong><%= f.Destination.place_name %></strong><br />
            <ul class="pad_bot1 list1">
              <li><span class="right color1">Price: <%= f.flight_price %>USD</span><a href="#"><%= f.Orgin.place_name %></a></li>
              <li><span class="right color1"><%= f.departure_date.ToShortDateString() %></span>Departure Date:</li>
              <li><span class="right color1"><%= snum %></span>Seat number:</li>>
              <li><span class="right color1"><input type="text"  value="" name="ticket_price" class="price"/>USD</span>Total:</li>
            </ul>
          </div>
        </div>
      </article>
      <article class="col2">
        <div class="box1">
          <div class="box2 top"> <strong>Please complete your details</strong> </div>
          <form id="form_8" action="/Ticket/SetTicket" class="form_5" method="post">
            <div>
              <div class="pad">
                <div class="wrapper under">
                  <div class="col1">
                    <div class="row"> <span class="left">From</span>
                      <input type="text" class="input" value="<%= f.Destination.place_name %>" onblur="if(this.value=='') this.value='<%= f.Destination.place_name %>'" onFocus="if(this.value =='<%= f.Destination.place_name %>' ) this.value=''">
                    </div>
                    <div class="row"> <span class="left">To</span>
                      <input type="text" class="input" value="<%= f.Orgin.place_name %>"  onblur="if(this.value=='') this.value='<%= f.Orgin.place_name %>'" onFocus="if(this.value =='<%= f.Orgin.place_name %>' ) this.value=''">
                    </div>
                  </div>
                </div>
                <div class="wrapper pad_bot2"> <span class="left">Passengers</span>
                  <div class="col2">
                  <span class="left">Children</span><input type="text" class="input2" value="0" name="child_num" onblur="if(this.value=='') this.value='0'" onFocus="if(this.value =='0' ) this.value=''">
                     </div>
                </div>
                <div class="wrapper under">
                      <div class="col1">
                          <div class="select1"><span class="left">Class</span>
                            <select name="class1"><option value="" >Select your class</option>
                <option value="business">business class</option>
                <option value="first">first class</option>
                <option value="club">club class</option>
                <option value="smoking">smoking</option>
                <option value="nonsmoking">Non smoking</option>
                </select>
                          </div>
                          <div class="select1"><span class="left">Airline</span>
                            <select name="type_id" class="keytype">
                    <option value="">ticket type</option>
                    <%
                        TypeTicketModels ttm = new TypeTicketModels();
                        List<TypeTicket> ds = (List<TypeTicket>)ViewData["ds"];
                        foreach (TypeTicket tt in ds)
                        {
                    %>
                    <option value="<%= tt.type_id %>"><%= tt.type_name %></option>
                    <%
                    
                    } %>
                </select>
                          </div>
                          <div class="select1"><span class="left">Payment Methods</span>
                            <select name="payment_id" >
                    <option value="">ticket type</option>
                    <%
                        PaymentModels pm = new PaymentModels();
                        List<formpayment> lf = pm.ListFormPayMent();
                        foreach (formpayment ff in lf)
                        {
                    %>
                    <option value="<%= ff.payment_id  %>"><%= ff.payment_name%></option>
                    <%
                    
                    } %>
                </select>
                          </div>
                      </div>
                    </div>
              </div>
              <div class="pad">
                <div class="wrapper"> <span class="left">Flights</span>
                  <div class="cols marg_right1">
                    <h6>Outbound flight</h6>
                    <div class="row">
                      <input type="text" class="input" value="<%= f.departure_date.ToShortDateString() %>"  onblur="if(this.value=='') this.value='<%= f.departure_date.ToShortDateString() %>'" onFocus="if(this.value =='<%= f.departure_date.ToShortDateString() %>' ) this.value=''">
                    </div>
                  </div>
                  <div class="cols">
                    <h5>Price flight</h5>
                    <div class="row">
                      <input type="text"  value="" name="ticket_price" class="price"/>
                    </div>
                  </div>
                </div>
                <div class="wrapper pad_bot1">
                  <span class="right relative"><input type="hidden" name="flight_id" value="<%= f.flight_id %>" /><input type="submit" class="button1" value="Book"/></span>
              </div>
            </div>
          </form>
        </div>
      </article>
    </div>
</asp:Content>
